package com.txz.system.service.impl;

import java.util.List;
import com.txz.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.txz.system.mapper.ZcnGoodsMapper;
import com.txz.system.domain.ZcnGoods;
import com.txz.system.service.IZcnGoodsService;

/**
 * 商品Service业务层处理
 * 
 * @author tuxiaozhuo
 * @date 2025-10-18
 */
@Service
public class ZcnGoodsServiceImpl implements IZcnGoodsService 
{
    @Autowired
    private ZcnGoodsMapper zcnGoodsMapper;

    /**
     * 查询商品
     * 
     * @param id 商品主键
     * @return 商品
     */
    @Override
    public ZcnGoods selectZcnGoodsById(Long id)
    {
        return zcnGoodsMapper.selectZcnGoodsById(id);
    }

    /**
     * 查询商品列表
     * 
     * @param zcnGoods 商品
     * @return 商品
     */
    @Override
    public List<ZcnGoods> selectZcnGoodsList(ZcnGoods zcnGoods)
    {
        return zcnGoodsMapper.selectZcnGoodsList(zcnGoods);
    }

    /**
     * 新增商品
     * 
     * @param zcnGoods 商品
     * @return 结果
     */
    @Override
    public int insertZcnGoods(ZcnGoods zcnGoods)
    {
        zcnGoods.setCreateTime(DateUtils.getNowDate());
        return zcnGoodsMapper.insertZcnGoods(zcnGoods);
    }

    /**
     * 修改商品
     * 
     * @param zcnGoods 商品
     * @return 结果
     */
    @Override
    public int updateZcnGoods(ZcnGoods zcnGoods)
    {
        zcnGoods.setUpdateTime(DateUtils.getNowDate());
        return zcnGoodsMapper.updateZcnGoods(zcnGoods);
    }

    /**
     * 批量删除商品
     * 
     * @param ids 需要删除的商品主键
     * @return 结果
     */
    @Override
    public int deleteZcnGoodsByIds(Long[] ids)
    {
        return zcnGoodsMapper.deleteZcnGoodsByIds(ids);
    }

    /**
     * 删除商品信息
     * 
     * @param id 商品主键
     * @return 结果
     */
    @Override
    public int deleteZcnGoodsById(Long id)
    {
        return zcnGoodsMapper.deleteZcnGoodsById(id);
    }
}
